Functions List
3D Modelling
• box
The function box
creates a box specified by either
two opposite vertices or by the base insertion point, length, width and height. If
omitted, the base insertion point is the UCS origin and all the box dimensions will
be 1.
Parameters:
p1 – Base insertion point
p2 – Opposite vertex to p1
p – Base insertion point
l – Box base length
w – Box base width
h – Box height
Syntax:
(box p1 p2)
(box p l w h)
Example:
> (box (xyz 0 0 0) (xyz 10 2 5))
#<box 0>
> (box (xyz 0 0 0) 10 2 5)
#<box 0>
> (box (xyz 0 0 0) 10 5)
#<box 0>
• cone
The function cone
creates a cone specified by either
the base centre point, base radius and height or by the base centre point, base radius
and top vertex. If omitted, the base insertion point will be considered the UCS origin,
the radius and height 1 and the top vertex placed immediately over the base centre point
at a height of 1.
Parameters:
c – Base centre point
r – Cone radius
h – Cone height
c1 – Base centre point
r – Cone radius
c2 –Top vertex
Syntax:
(cone [c (u0)] [r 1] [h 1])
(cone [c1 (u0)] [r 1] [c2 (+z (u0) 1)])
Example:
> (cone (xyz 0 0 0) 5 10)
#<cone 0>
> (cone (xyz 0 0 0) 5 (xyz 1 3 10))
#<cone 0>
• cone-frustum
The function cone-frustum
creates a truncated cone
specified by either the base centre point, base radius and top radius or by the base
centre point, base radius, top centre point and top radius. If omitted, the base
insertion point will be considered the UCS origin, the radii and height 1, or the top
vertex place over the base insertion point at a distance of 1.
Parameters:
c – Base centre point
r1 – Base radius
h – Cone height
r2 – Top radius
c1 – Base centre point
r1 – Base radius
c2 –Top vertex
r2 – Top radius
Syntax:
(cone-frustum [c (u0)] [r1 1] [h 1] [r2 1])
(cone-frustum [c (u0)] [r1 1] [c2 (+z c1 1)] [r2 1])
Example:
> (cone-frustum (xyz 0 0 0) 5 10 3)
#<cone 0>
> (cone-frustum (xyz 0 0 0) 5 (xyz 1 3 10) 3)
#<cone 0>
• sphere
The function sphere
creates a sphere specified by its
centre point and radius. If omitted, the insertion point will be considered the UCS
origin and radius 1.
Parameters:
c – Sphere centre point
r – Sphere radius
Syntax:
(sphere [c (u0)] [r 1])
Example:
> (sphere (xyz 0 0 0) 10)
#<sphere 0>
• cylinder
The function cylinder
creates a cylinder specified by
the base centre point, base radius and height or by the base centre point, base radius
and top centre point. If omitted, the base insertion point is considered the UCS origin,
the base radius 1 and height 1 or the top centre point place immediately over the base
centre point at a height of 1.
Parameters:
c – Base centre point
r – Base radius
h – Cylinder height
c1 – Base centre point
r – Base radius
c2 – Top centre point
Syntax:
(cylinder [c (u0)] [r 1] [h 1])
(cylinder [c1 (u0)] [r 1] [c2 (+z c1 1)]])
Example:
> (cylinder (xyz 0 0 0) 5 10)
#<cylinder 0>
> (cylinder (xyz 0 0 0) 5 (xyz 1 5 10))
#<cylinder 0>
• regular-pyramid
The function regular-pyramid
creates a pyramid from a
regular polygon. It is specified by the base number of sides, the base centre point,
base radius, angle between the first base vertex and the X axis, height and a Boolean
value to indicate if the base polygon is inscribed or circumscribed. Instead of specify
the height it is also possible to specify the top vertex instead. If omitted, the number
of sides will be 4, the base insertion point will be considered the UCS origin, radius and
height 1, angle 0 and the base polygon will be circumscribed, or the top vertex will be
placed immediately over the base insertion point at a height of 1
Parameters:
n – Base number of sides
c – Base centre point
r – Base radius
a – Base angle
h – Pyramid height
n – Base number of sides
c1 – Base centre point
r – Base radius
a – Base angle
c2 – Top vertex
Syntax:
(regular-pyramid [n 4] [c (u0)] [r 1] [h 1] [a 0] [inscribed? #f])
(regular-pyramid [n 4] [c1 (u0)] [r 1] [c2 (+z c1 1)] [a 0] [inscribed? #f])
Example:
> (regular-pyramid 4 (xyz 0 0 0) 1 0 1 #t)
#<(regular-pyramid regular-pyramid-frustum loft-curve-point) 8>
> (regular-pyramid 5 (xyz -2 1 0) 1 0 (xyz 2 7 7))
#<(regular-pyramid regular-pyramid-frustum loft-curve-point) 8>
• irregular-pyramid
The function irregular-pyramid
creates a pyramid from
an irregular polygon, by specifying the list of base points, top vertex and a Boolean
value for indicating if the result is a solid (#t) or a surface (#f). If omitted, the
result will be a solid. A solid can only be created if the base forms a planar surface.
Parameters:
p1, p2, p3, p4, …, pn – List of base points
h – Pyramid height
#t/#f – Solid or surface
p1, p2, p3, p4, …, pn – List of base points
c – Top vertex
#t/#f – Solid or surface
Syntax:
(irregular-pyramid (list p1 p2 p3 p4 … pn) [h/c 1] [solid? #t])
Example:
(irregular-pyramid
(list (xy 0 0)
(xy 2 0)
(xy 4 2)
(xy 3 5)
(xy 1 3))
(xyz 5 5 5)
#t)
#<(irregular-pyramid loft-curve-point) 5>
• regular-pyramid-frustum
The function regular-pyramid-frustum
creates a
truncated pyramid from a regular polygon. It is specified by the base number of
sides, the base centre point, base radius, angle between the first base vertex
and the X axis, height, top radius and a Boolean value to indicate if the base
polygon is inscribed or circumscribed. Instead of specify the height it is also
possible to specify the top vertex instead. If omitted, the number of sides will
be 4, the base insertion point will be considered the UCS origin, radii and height
1, angle 0 and the base polygon will be circumscribed, or the top vertex will be
placed immediately over the base insertion point at a height of 1
Parameters:
n – Base number of sides
c – Base centre point
r1 – Base radius
a – Base angle
h – Pyramid height
r2 – Top radius
n – Base number of sides
c1 – Base centre point
r1 – Base radius
a – Base angle
c2 – Top vertex
r2 – Top radius
Syntax:
(regular-pyramid [n 4] [c (u0)] [r 1] [h 1] [a 0] [inscribed? #f])
(regular-pyramid [n 4] [c1 (u0)] [r 1] [c2 (+z c1 1)] [a 0] [inscribed? #f])
Example:
> (regular-pyramid-frustum 4 (xy 0 0) 1 0 1)
#<(regular-pyramid-frustum loft-curves) 7>
• torus
The function torus
creates a torus specified by
the centre point, radius and section radius. If omitted, the centre point will be
considered the UCS origin, the radius 1 and section radius 0.5.
Parameters:
p – Torus centre point
rt – Torus radius
rs – Section radius
Syntax:
(torus [p (u0)] [rt 1] [rs 0.5])
Example:
> (regular-pyramid-frustum 4 (xy 0 0) 1 0 1)
#<(regular-pyramid-frustum loft-curves) 7>
• regular-prism
The function regular-prism
creates a prism from a
regular polygonal base, specified by the number of sides, base centre point, base
radius, angle between the first base vertex and the X axis and height.
Parameters:
p – Torus centre point
rt – Torus radius
rs – Section radius
Syntax:
(torus [p (u0)] [rt 1] [rs 0.5])
Example:
> (regular-pyramid-frustum 4 (xy 0 0) 1 0 1)
#<(regular-pyramid-frustum loft-curves) 7>
• irregular-prism
The function irregular-prism
creates a prism from
an irregular polygonal base, specified by a list of points for the base, height
(or top base point) and a Boolean value for indicating if the result is a solid (#t)
or a surface (#f). If omitted, the height will be considered 1, or the top base point
will be positioned immediately above the base, and the final result will be a solid.
A solid can only be created if the base forms a planar surface.
Parameters:
p1, p2, p3, p4, …, pn – List of base points
h – Prism height
#t/#f – Solid or surface
p1, p2, p3, p4, …, pn – List of base points
c – Top base point
#t/#f – Solid or surface
Syntax:
(irregular-prism (list p1 p2 p3 p4 … pn) [h/c 1] [solid? #t])
Example:
> (irregular-prism
(list (xy 0 0)
(xy 2 0)
(xy 4 2)
(xy 3 5)
(xy 1 3))
10
#t)
#<(irregular-prism loft-curves) 5>
> (irregular-prism
(list (xy 0 0)
(xy 2 0)
(xy 4 2)
(xy 3 5)
(xy 1 3))
(xyz 2 2 10)
#t)
#<(irregular-prism loft-curves) 5>
• cuboid
The function cuboid
creates a convex polyhedron bounded
by eight specified vertices, four for the bottom surface and the remaining four for the
top base. The points should be specified in order.
Parameters:
p1, p2, p3, p4, p5, p6, p7, p8 – Cuboid vertices
Syntax:
(cuboid p1 p2 p3 p4 p5 p6 p7 p8)
Example:
> (cuboid (xyz 4 0 0) (xyz 5 0 0) (xyz 5 2 0) (xyz 4 2 0)
(xyz 3 1 2) (xyz 5 1 2) (xyz 5 2 2) (xyz 3 2 2))
#<cuboid 0>
• right-cuboid
The function right-cuboid
is similar to the box function
in that it creates a rectangular prism. The difference however is that the insertion point
given is not one of the base vertices but the base centroid. The function takes as parameters
the base centre point, the width, length and height of the cuboid, or alternatively the top
centroid point instead of the height. If omitted, the base centre point will be considered
the UCS origin and all dimensions will have a value of 1. The top centre point will be
positioned immediately above the base centre point.
Parameters:
p – Base centre point
l – Cuboid length
w – Cuboid width
h – Cuboid height
p1 – Base centre point
l – Cuboid length
w – Cuboid width
h – Cuboid height
p2 – Top centre point
Syntax:
(right-cuboid [p (u0)] [l 1] [w 1] [h 1])
(right-cuboid [p1 (u0)] [l 1] [w 1] [p2 (+z p1 1]))
Example:
> (right-cuboid)
#<cuboid 0>